const mongoose = require('mongoose')
let { Schema, model, connect } = mongoose

connect('mongodb://localhost/studentManger')
    // 设计文档结构
    // 创建模型对象
let studentSchema = new Schema({
    name: {
        type: String,
        required: true
    },
    gender: {
        type: Number,
        enum: [0, 1],
        default: 0
    },
    hobbies: {
        type: String
    },
    level: {
        type: String
    }
})



// 导出模型构造函数
module.exports = model('Student', studentSchema)